package views;

import docks.Dock;
import android.content.Context;
import android.widget.ArrayAdapter;

public class ListController extends ArrayAdapter {

    protected Dock[] items;

    public ListController(Context context, int textViewResourceId,
	    Object[] objects) {
	super(context, textViewResourceId, objects);
	this.items = (Dock[]) objects;
    }

    private static views.DockList.IconicAdapter allAdapter;
    private static views.DockStarred.IconicAdapter starredAdapter;
    private static DockStarred ds;
    private static DockList dl;

    public static void notifyChanges() {

	if (allAdapter != null) {
	    allAdapter.notifyDataSetChanged();
	}

	if (ds != null) {

	    ds.setListAdapter();
	}
    }

    public static void notifyChangesToAll() {

	if (allAdapter != null) {

	    dl.setListAdapter();
	}
    }

    public static void setAllAdapter(views.DockList.IconicAdapter aa) {

	allAdapter = aa;
    }

    public static void setStarredAdapter(views.DockStarred.IconicAdapter aa) {

	starredAdapter = aa;
    }

    public static void setDockStarred(DockStarred dss) {

	ds = dss;
    }

    public static void setDockList(DockList dll) {

	dl = dll;
    }
}
